body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f4f8;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top */
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px; 
    text-align: center;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

p {
    color: #555;
    margin-bottom: 20px;
}

.intelligence-tracker {
    background-color: #eaf2f8;
    border: 1px solid #d4e6f1;
    border-left: 5px solid #3498db;
    padding: 10px 15px;
    margin-bottom: 25px;
    border-radius: 5px;
    text-align: left;
}
.intelligence-tracker h3 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 1.1em;
}
.intelligence-tracker p {
    margin: 0;
    font-size: 0.9em;
    color: #566573;
}
#intelligenceScore {
    font-weight: bold;
    color: #3498db;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
}

.select-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: 300px;
}

.select-group label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #34495e;
}

select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    background-color: #f9f9f9;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

#generateVariantsBtn {
    background-color: #2ecc71; 
}
#generateVariantsBtn:hover {
    background-color: #27ae60;
}

.secondary-action-button { /* For Fix button */
    background-color: #f39c12; /* Orange */
}
.secondary-action-button:hover {
    background-color: #e67e22; /* Darker Orange */
}

.loading {
    margin: 20px 0;
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-container {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
}

#hybridName {
    color: #e74c3c;
    margin-bottom: 20px; 
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px; 
    margin-bottom: 20px;
}

.image-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.image-card.img-error-state {
    border-color: #c0392b; /* Red border if image failed */
    background-color: #fef5f5;
}
.image-card.img-error-state img {
    display: none; /* Hide broken img tag if error state used for card */
}
.image-card.img-error-state::after {
    content: "Image Error";
    color: #c0392b;
    font-style: italic;
    min-height: 100px; /* ensure space */
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-card h3 {
    font-size: 1em; 
    color: #34495e;
    margin-top: 0;
    margin-bottom: 10px;
}

.image-gallery img, .variants-gallery img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 2px solid #eee;
    aspect-ratio: 1 / 1; 
    object-fit: cover; 
    background-color: #f0f0f0; 
    margin-bottom: 10px; /* Add some margin below images in cards */
}

.image-gallery img.img-loading, .variants-gallery img.img-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px; 
}
.image-gallery img.img-loading::before, .variants-gallery img.img-loading::before {
    content: "Loading Image...";
    font-style: italic;
    color: #888;
}

#hybridFunFact {
    font-style: italic;
    color: #555;
    background-color: #e8f4fd;
    padding: 10px;
    border-left: 4px solid #3498db;
    border-radius: 4px;
    margin-top: 20px; 
    margin-bottom: 20px; 
}

.traits-container {
    margin-bottom: 20px;
    text-align: left;
}

.traits-container h3 {
    font-size: 1.1em;
    color: #34495e;
    margin-bottom: 10px;
    text-align: center;
}

.traits-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.trait-tag {
    background-color: #e0eafc;
    color: #34495e;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    border: 1px solid #c3d4f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.trait-tag.no-trait {
    background-color: #f9f9f9;
    color: #777;
    font-style: italic;
    border-color: #eee;
}

.trait-tag.failed-hybrid-trait {
    background-color: #ffdddd; 
    color: #a00000; 
    border-color: #ffaaaa;
    font-weight: bold;
}

.trait-tag.fungus-risk-trait {
    background-color: #fff0b3; /* Light yellow/orange */
    color: #8c5300; /* Dark orange/brown text */
    border-color: #ffe066;
    font-weight: normal; /* Not as alarming as failed */
}

.trait-tag.stabilized-trait {
    background-color: #d4efdf; /* Light green */
    color: #196f3d; /* Dark green text */
    border-color: #a9dfbf;
    font-weight: bold;
}

.failed-hybrid-result {
    border: 2px solid #c0392b; 
    background-color: #fff0f0; 
}

.failed-hybrid-result #hybridName {
    color: #8B0000; 
}
.failed-hybrid-result #hybridName::before {
    content: "⚠️ "; 
    color: #8B0000; 
}

.error-message {
    color: #c0392b;
    background-color: #fbeaea;
    border: 1px solid #e8adaa;
    padding: 10px;
    border-radius: 5px;
    margin: 20px 0;
}

.success-message.fix-message { /* For successful fix messages */
    color: #1e8449;
    background-color: #e8f8f0;
    border: 1px solid #a2d9b8;
    padding: 10px;
    border-radius: 5px;
    margin: 15px 0; /* Consistent with fixLoading */
}
.error-message.fix-message { /* For failed fix messages, ensure it uses general error styling */
     margin: 15px 0; /* Consistent with fixLoading */
}

.variants-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.variant-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.variant-card.failed-variant-card {
    border-color: #c0392b; 
    background-color: #fff5f5; 
}
.variant-card.failed-variant-card h4 {
    color: #8B0000; 
}
.variant-card.failed-variant-card h4::before {
    content: "⚠️ "; 
}

.variant-card h4 {
    font-size: 0.9em;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 8px;
}

.variant-traits-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px; 
    justify-content: center;
    margin-top: 8px;
    margin-bottom: 8px;
}

.variant-card img {
    margin-bottom: 10px;
}

.variant-card p {
    font-size: 0.8em;
    color: #555;
    margin-bottom: 0;
    flex-grow: 1; 
}

.society-name-text {
    font-weight: bold;
    font-size: 0.95em;
    color: #333;
    margin-top: 5px;
    margin-bottom: 5px;
}

.society-description-text {
    font-size: 0.85em;
    color: #555;
    margin-top: 0; /* Adjusted margin */
    text-align: left;
    flex-grow: 1; /* Allow description to take available space */
}